import request from '@/utils/request'
// get请求
export const getdata = (url, params = {}) => {
    return new Promise((resolve, reject) => {
        request.get(url, {params})
            .then(response => {
                resolve(response.data); //返回请求的数据
            })
            .catch(error => {
                reject(error); // 抛出错误
            })
    })
}
// post请求
export const postdata = (url, data = {}) => {
    return new Promise((resolve, reject) => {
        request.post(url, data)
            .then(response => {
                resolve(response.data); //返回请求的数据
            })
            .catch(error => {
                reject(error); // 抛出错误
            })
    })
}
